Prev |
In this section, you will find the detailed examples which show how to configure a custom site in the web.config file.
1. Example 1
Item set:
Physical folder contents:
web.config configuration:
<site
name="helloworld"
hostName="www.helloworld.com"
virtualFolder="/"
physicalFolder="/hello"
rootPath="/sitecore/content"
startItem="/Hello Home"
database="web"
domain="extranet"
/>
Helloworld site is placed before the website.
hosts file configuration:
127.0.0.1 localhost
127.0.0.1 www.helloworld.com
Results:
http://localhost – the default website site is displayed;
http://localhost/?sc_site=helloworld - the helloworld site is displayed ( Hello Home item is rendered );
http://www.helloworld.com – the helloworld site is displayed ( Hello Home item is rendered );
http://www.helloworld.com/test_page.html - the page from the physical folder is displayed (although there is the Item with the same name under the Hello Home Item)
2. Example 2
The Item set and physical folder contents are the same as in Example 1.
web.config configuration:
<site
name="helloworld"
hostName="www.helloworld.com"
virtualFolder="/virtual"
physicalFolder="/hello"
rootPath="/sitecore/content"
startItem="/Hello Home"
database="master"
domain="extranet"
filterItems="true"
/>
Helloworld site is placed before the website.
hosts file configuration:
127.0.0.1 localhost
127.0.0.1 www.helloworld.com
Results:
http://localhost – the default website site is displayed;
http://localhost/?sc_site=helloworld - the helloworld site is displayed (Hello Home item is rendered);
http://www.helloworld.com/virtual/ - - the helloworld site is displayed (Hello Home item is rendered);
http://www.helloworld.com/ - the default website site is displayed;
http://www.helloworld.com/virtual/test_page.html - the page from the physical folder is displayed (although there is the Item with the same name under the Hello Home Item);
The helloworld site takes content directly from the master database (database="master"), thus there is no need to publish the site from the client. The filterItems attribute is set to "true", so that it is possible to use the Publishing and Lifetime restrictions.
Prev